﻿namespace Tszy.Unlimited.Base.Infrastructure.Queues.RabbitMQ;

/// <summary>
/// 收到消息时触发。
/// </summary>
public class RabbitMQRecivedEventArgs : EventArgs
{
    private string _routingKey = string.Empty;
    private string _exchangeName = string.Empty;
    private string _content = string.Empty;

    /// <summary>
    /// 当前消息发送到的交换机名称。
    /// </summary>
    public string ExchangeName
    {
        get
        {
            if (string.IsNullOrWhiteSpace(_exchangeName))
            {
                return string.Empty;
            }

            return _exchangeName;
        }
        set
        {
            _exchangeName = value;
        }
    }

    /// <summary>
    /// 当前消息发送到的路由 KEY。
    /// </summary>
    public string RoutingKey
    {
        get
        {
            if (string.IsNullOrWhiteSpace(_routingKey))
            {
                return string.Empty;
            }

            return _routingKey;
        }
        set
        {
            _routingKey = value;
        }
    }

    /// <summary>
    /// 消息内容。
    /// </summary>
    public string Content
    {
        get
        {
            if (string.IsNullOrWhiteSpace(_content))
            {
                return string.Empty;
            }

            return _content;
        }
        set
        {
            _content = value;
        }
    }

    /// <summary>
    /// 配置。
    /// </summary>
    public RabbitMQConfig? Config { get; set; }
}